package com.cskaoyan.shopping.converter;

import com.cskaoyan.mall.dto.ProductDetailDto;
import com.cskaoyan.mall.dto.ProductDto;
import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dal.entitys.Panel;
import com.cskaoyan.shopping.dal.entitys.PanelContentItem;
import com.cskaoyan.shopping.dto.AllProductRequest;
import com.cskaoyan.shopping.dto.PanelContentItemDto;
import com.cskaoyan.shopping.dto.PanelDto;
import com.cskaoyan.shopping.form.PageInfo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author: DYQ
 * @time: Created on 2022/6/19 16:31
 */

@Mapper(componentModel = "spring")
public interface ProductDetailConventer {

    @Mappings(
            {
             @Mapping(source = "id", target = "productId"),
             @Mapping(source = "price", target = "salePrice"),
             @Mapping(source = "title", target = "productName"),
             @Mapping(source = "imageBig", target = "productImageBig"),
//             @Mapping(source = "image", target = "productImageSmall")
            }
    )
    ProductDetailDto item2ProductDetailDto(Item item);

    @Mappings(
            {
                    @Mapping(source = "id", target = "productId"),
                    @Mapping(source = "price", target = "salePrice"),
                    @Mapping(source = "title", target = "productName"),
                    @Mapping(source = "sellPoint", target = "subTitle"),
                    @Mapping(source = "imageBig", target = "picUrl")
            }
    )
    ProductDto item2ProductDto(Item item);

    List<ProductDto> items2ProductDtos(List<Item> items);

    AllProductRequest pageInfo2AllProductRequset(PageInfo pageInfo);

    PanelContentItemDto panelContentItem2PanelContentItemDto(PanelContentItem panelContentItem);

    List<PanelContentItemDto> panelContentItems2PanelContentItemDto(List<PanelContentItem> panelContentItems);

    PanelDto panel2PanleDto(Panel panel);




}
